package com.xywl.escort.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import com.xywl.escort.R;
import com.xywl.escort.bean.CommentsResp;
import com.xywl.escort.widget.GlideApp;

import java.util.List;

public class EvaluateAdapter extends BaseQuickAdapter<CommentsResp.DataBean.ListBean, BaseViewHolder> {
    public EvaluateAdapter(int layoutResId, @Nullable List<CommentsResp.DataBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CommentsResp.DataBean.ListBean item) {
        RoundedImageView imgAvatar = helper.getView(R.id.img_avatar);
        GlideApp.with(mContext)
                .load(item.userIcon)
                .centerCrop()
                .placeholder(R.mipmap.icon_default_picture)
                .into(imgAvatar);

        TextView textSkuName = helper.getView(R.id.text_sku_name);
        if (null != textSkuName) {
            String skuName = "规格: " + item.skuName;
            textSkuName.setText(skuName);
        }
        helper.setText(R.id.text_name, item.userName);
        String content = "\t\t" + item.content;
        helper.setText(R.id.text_content, content);

        TextView textTime = helper.getView(R.id.text_time);
        if (null != textTime) {
            textTime.setText(item.publishTime);
        }
    }
}
